package com.ok.prize.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ok.prize.domain.po.OkPrize;
import com.ok.prize.mapper.OkPrizeMapper;
import com.ok.prize.service.IOkPrizeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.reflections.util.Utils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 奖品 服务实现类
 * </p>
 *
 * @author lhw
 * @since 2024-05-06
 */
@Service
public class OkPrizeServiceImpl extends ServiceImpl<OkPrizeMapper, OkPrize> implements IOkPrizeService {

    @Override
    public Page<OkPrize> pageWith(Integer pageNo, Integer pageSize, String name) {
        Page<OkPrize> pageInfo = new Page<>(pageNo,pageSize);
        //构建分类id条件
        LambdaQueryWrapper<OkPrize> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(!Utils.isEmpty(name),OkPrize::getName,name);

        this.page(pageInfo,queryWrapper);
        return pageInfo;
    }
}
